<%@ page import="java.lang.reflect.Array,
                 com.actimind.actitime.util.Capsule,
                 com.actimind.actitime.administration.UserManager,
                 com.actimind.actitime.beans.UserBean,
                 com.actimind.actitime.Version,
                 com.actimind.actitime.Keys,
                 com.actimind.actitime.resources.UserResource,
                 java.sql.SQLException,
                 com.actimind.actitime.AccessRights,
                 com.actimind.actitime.administration.NoSuchUserException,
                 java.io.IOException,
                 com.actimind.actitime.beans.UserAccessRightsBean,
                 com.actimind.actitime.util.StringUtils,
                 com.actimind.actitime.reports.StaffOutputReportAction"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<bean:define id="user" name="<%=Keys.LOGGEDIN_USER_KEY%>" type="UserBean" scope="session"/>
<bean:define id="rights" name="<%=Keys.LOGGEDIN_USER_RIGHTS_KEY%>" scope="session" type="UserAccessRightsBean"/>
<bean:define id="firstShown" value="false" scope="page"/>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
    <td bgcolor="#000000"><font color="white"><h2> &nbsp;Intelligent&nbsp;TimeTracking&nbsp;Identification&nbsp;and&nbsp;efficient&nbsp;billing&nbsp;management&nbsp;Software</font></h2></td>
    <td bgcolor="#000000" colspan="3">
        <table cellpadding=0 cellspacing=0 border=0 width=100%>
            <tr>
                
                <td class="nav" align=center style="color:#838A97;" width="30%"></center></td>
                <td class="nav" align=left width="40%">User: <bean:write name="user" property="firstName"/><logic:notEmpty name="user" property="middleName"> <bean:write name="user" property="middleName"/>.</logic:notEmpty> <bean:write name="user" property="lastName"/> (<bean:write name="user" property="username"/>)&nbsp;</td></center>
            </tr>
        </table>
    </td>
</tr>
<tr bgcolor="#0D2B68">
    
    <td width="100%" align="center">
        <table cellspacing="4" cellpadding="0" border="0">
        <tr>
            <logic:equal name="user" property="root" value="false">
            <% if( rights.hasRight( AccessRights.SUBMIT_TIME_TRACK ) ) {%>
                <bean:define id="firstShown" value="true" scope="page"/>
                <td class="nav" nowrap="1" valign="top">
                    <logic:equal parameter="pageSection" value="submit_tt" >
                        Submit Time-Track
                    </logic:equal>
                    <logic:notEqual parameter="pageSection" value="submit_tt" >
                        <html:link page="/user/submit_tt.do?dateStr=" styleClass="navlink" >Submit Time-Track</html:link>
                    </logic:notEqual>
                    &nbsp;|&nbsp;
                </td>
                <td class="nav" nowrap="1" valign="top">
                    <logic:equal parameter="pageSection" value="my_tt" >
                        My Time-Track
                    </logic:equal>
                    <logic:notEqual parameter="pageSection" value="my_tt" >
                        <html:link page="/user/my_tt.do" styleClass="navlink" >My Time-Track</html:link>
                    </logic:notEqual>
                </td>
            <% } %>
            </logic:equal>
            <% if (user.isRoot() || rights.hasRight(AccessRights.MANAGE_TASKS) || rights.hasRight(AccessRights.SUBMIT_TIME_TRACK)) { %>
                <td class="nav" nowrap="1" valign="top">
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageSection" value="tasks" >
                        Tasks
                    </logic:equal>
                    <logic:notEqual parameter="pageSection" value="tasks" >
                        <html:link action="/tasks/otasklist" styleClass="navlink" >Tasks</html:link>
                    </logic:notEqual>
                </td>
            <% } %>
            <% if( user.isRoot() || rights.hasRight( AccessRights.MANAGE_PROJECTS ) || rights.hasRight( AccessRights.MANAGE_CUSTOMERS ) ) {%>
                <td class="nav" nowrap="1" valign="top">
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageSection" value="project" >
                        Projects & Customers
                    </logic:equal>
                    <logic:notEqual parameter="pageSection" value="project" >
                        <html:link action="/project/projects" styleClass="navlink" >Projects & Customers</html:link>
                    </logic:notEqual>
                </td>
            <% } %>
            <% if( rights.hasRight( AccessRights.SUBMIT_TIME_TRACK ) || rights.hasRight( AccessRights.GENERATE_REPORTS ) || rights.hasRight( AccessRights.PREPARE_INVOICE_DATA ) ) {%>
                <td class="nav" nowrap="1" valign="top">
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageSection" value="reports" >
                        Reports
                    </logic:equal>
                    <logic:notEqual parameter="pageSection" value="reports" >
                        <html:link action="/reports/reports" styleClass="navlink" >Reports</html:link>
                    </logic:notEqual>
                </td>
            <% } %>
            <% if( user.isRoot() || rights.hasRight( AccessRights.MANAGE_USERS ) || rights.hasRight( AccessRights.MANAGE_BILLING_TYPES ) || rights.hasRight( AccessRights.MANAGE_CALENDAR_PREFS ) ) {%>
                <td class="nav" nowrap="1" valign="top">
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageSection" value="administration" >
                        Administration
                    </logic:equal>
                    <logic:notEqual parameter="pageSection" value="administration" >
                        <html:link action="/administration/administration" styleClass="navlink" >Administration</html:link>
                    </logic:notEqual>
                </td>
            <% } %>
            <td class="nav" nowrap="1" valign="top">
                <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                <bean:define id="firstShown" value="true" scope="page"/>
                <logic:equal parameter="pageSection" value="profile" >
                    My Profile
                </logic:equal>
                <logic:notEqual parameter="pageSection" value="profile" >
                    <html:link page="/profile.do" styleClass="navlink" >My Profile</html:link>
                </logic:notEqual>
            </td>
        </tr>
        </table>
    </td>
    <td><html:link page="/login.do?logout=1"><html:img page="/img/logout.gif" width="58" height="17" border="0" alt="Logout" /></html:link>&nbsp;&nbsp;&nbsp;</td>
</tr>
</table>
<bean:define id="firstShown" value="false" scope="page"/>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr><td><html:img page="/img/pixel.gif" hspace="0" vspace="0" border="0" width="800" height="2"/></td></tr>
    <tr valign="top">
        <td nowrap="1" class="navsub" align="center">
            <logic:equal parameter="pageSection" value="tasks" >
                <% if( user.isRoot() || rights.hasRight(AccessRights.MANAGE_TASKS) || rights.hasRight(AccessRights.SUBMIT_TIME_TRACK) ) {%>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageAction" value="otasklist" >
                        Open Tasks
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="otasklist" >
                        <html:link page="/tasks/otasklist.do" styleClass="navsublink" >Open Tasks</html:link>
                    </logic:notEqual>
                    &nbsp;|&nbsp;
                    <logic:equal parameter="pageAction" value="ctasklist" >
                        Completed Tasks
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="ctasklist" >
                        <html:link page="/tasks/ctasklist.do" styleClass="navsublink" >Completed Tasks</html:link>
                    </logic:notEqual>
                <% } %>
            </logic:equal>
            <logic:equal parameter="pageSection" value="project" >
                <% if( user.isRoot() || rights.hasRight( AccessRights.MANAGE_PROJECTS ) ) {%>
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageAction" value="projectlist" >
                        Projects
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="projectlist" >
                        <html:link page="/project/projectlist.do" styleClass="navsublink" >Projects</html:link>
                    </logic:notEqual>
                <% } %>
                <% if( user.isRoot() || rights.hasRight( AccessRights.MANAGE_CUSTOMERS ) ) {%>
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageAction" value="customerlist" >
                        Customers
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="customerlist" >
                        <html:link page="/project/customerlist.do" styleClass="navsublink" >Customers</html:link>
                    </logic:notEqual>
                <% } %>
            </logic:equal>
            <logic:equal parameter="pageSection" value="reports" >
                <% if( rights.hasRight( AccessRights.GENERATE_REPORTS ) ) {%>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageAction" value="billingsummary" >
                        Billing Summary Report
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="billingsummary" >
                        <html:link page="/reports/billingsummary.do" styleClass="navsublink" >Billing Summary Report</html:link>
                    </logic:notEqual>
                <% } %>
                <% if( rights.hasRight( AccessRights.SUBMIT_TIME_TRACK ) || rights.hasRight( AccessRights.GENERATE_REPORTS ) ) {%>
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageAction" value="staffoutput" >
                        <%= StaffOutputReportAction.getReportTitle(request) %>
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="staffoutput" >
                        <html:link page="/reports/staffoutput.do" styleClass="navsublink" ><%= StaffOutputReportAction.getReportTitle(request) %></html:link>
                    </logic:notEqual>
                <% } %>
                <% if( rights.hasRight( AccessRights.GENERATE_REPORTS ) ) {%>
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <logic:equal parameter="pageAction" value="overtime" >
                        Overtime Report
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="overtime" >
                        <html:link page="/reports/overtime.do" styleClass="navsublink" >Overtime Report</html:link>
                    </logic:notEqual>
                <% } %>
                <% if( rights.hasRight( AccessRights.PREPARE_INVOICE_DATA ) ) {%>
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageAction" value="prepareinvoice" >
                        Prepare Invoice Data
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="prepareinvoice" >
                        <html:link page="/reports/prepareinvoice.do" styleClass="navsublink" >Prepare Invoice Data</html:link>
                    </logic:notEqual>
                <% } %>
            </logic:equal>
            <logic:equal parameter="pageSection" value="administration" >
                <% if( user.isRoot() || rights.hasRight( AccessRights.MANAGE_USERS ) ) {%>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageAction" value="userlist" >
                        Users
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="userlist" >
                        <html:link page="/administration/userlist.do" styleClass="navsublink" >Users</html:link>
                    </logic:notEqual>
                <% } %>
                <% if( user.isRoot() || rights.hasRight( AccessRights.MANAGE_BILLING_TYPES ) ) {%>
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageAction" value="btlist" >
                        Billing Types
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="btlist" >
                        <html:link page="/administration/btlist.do" styleClass="navsublink" >Billing Types</html:link>
                    </logic:notEqual>
                <% } %>
                <% if( user.isRoot() || rights.hasRight( AccessRights.MANAGE_CALENDAR_PREFS ) ) {%>
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageAction" value="workdays" >
                        Working and Nonworking Days
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="workdays" >
                        <html:link page="/administration/workingdays.do?daySelected=0" styleClass="navsublink" >Working and Nonworking Days</html:link>
                    </logic:notEqual>
                    <logic:equal name="firstShown" value="true" scope="page">&nbsp;|&nbsp;</logic:equal>
                    <bean:define id="firstShown" value="true" scope="page"/>
                    <logic:equal parameter="pageAction" value="editcalprefs" >
                        Calendar Preferences
                    </logic:equal>
                    <logic:notEqual parameter="pageAction" value="editcalprefs" >
                        <html:link page="/administration/calprefs.do" styleClass="navsublink" >Calendar Preferences</html:link>
                    </logic:notEqual>
                <% } %></logic:equal>
        </td>
    </tr>
</table>
<br>